Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix the api part of #531 by providing an api call to export all CREs … #532

Merged
merged 2 commits into from
Jul 28, 2024

Conversation

northdpole
Copy link
Collaborator

@northdpole northdpole commented Jul 21, 2024

…in an instance in a visually pleasing format

This produces spreadsheets like this one https://docs.google.com/spreadsheets/d/10jrVWRRw-zCVFVgzumnO7xgNTjZYU6M6B9EDqss9zxY/edit?usp=sharing

Todo:

  • adjust headers
  • ensure data consistency

@northdpole northdpole force-pushed the feature-531-offseted-cre-csv branch from a1e4b9c to 090ba95 Compare July 21, 2024 12:54
@robvanderveer
Copy link
Collaborator

robvanderveer commented Jul 24, 2024

Copy link
Collaborator

@robvanderveer robvanderveer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I leave it to you Spyros what to do with the comments. This code looks like it will work, but it needs some changing to have the functionality we want.

application/web/web_main.py Outdated Show resolved Hide resolved

rows.append({f"CRE{offset}-ID": cre.id})
visited_cres.add(cre.id)
dbcre = database.get_CREs(external_id=cre.id)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this name get_CREs is unclear about what you're getting and so is dbcre. You're looking for linked CREs, right? Rename?

rows.append({f"CRE{offset}-ID": cre.id})
visited_cres.add(cre.id)
dbcre = database.get_CREs(external_id=cre.id)
if not dbcre:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is not dbcre true if dbcre is empty or if there has been an error in get_CREs?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dbcre should be None in case of error

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does not None resolve to true?

)
)
elif link.ltype == defs.LinkTypes.Related:
related.add(link.document.id)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently this code is doing nothing with related CRES, but we need to have them in the template at some point, for the template to be usable for changing the catalog. We have two options: add them as id|name list in one extra column, or add them as rows, just like we're adding the children (contains) as rows. I think the latter is easier to read but more confusing. So I vote for one column for the related CRES. This would require building up a dictionary of the related id|name pairs, and then adding them to rows, together with the CRE in a dictionary of two (or one if there is no related CRES.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently this code is doing nothing with related CRES, but we need to have them in the template at some point, for the template to be usable for changing the catalog.

I agree

We have two options: add them as id|name list in one extra column, or add them as rows, just like we're adding the children (contains) as rows

We could have a column named "Related CRE" sure,
then we can add the CRE listed in this column with a related type link,
During importing tehn we have the hierarchy on the left, then one column with related CREs, then an arbitrary number of standard entries. Do we link each standard to both the normal cre and the related one? This seems a bit confusing for people.

Since we want to be capturing more complex relationships in a 2 dimensional matrix I think we should consider a more verbose and less context-based format.

e.g.

  • perhaps there should be 2 formats, 1 for mapping standards and one for links between cres
  • alternatively perhaps everything should be considered a standard, CREs-included, we forget the hierarchy and just support a link between only 2 standards for each CSV, these 2 standards are CRE and any standard, for this we need to explicitly include the relationship type in a column.

In any case, this is beyond the scope of this particular pull request, let's think about this a bit more, let me know when you are free for a brainstorming session

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The mapping template specifies with which CRE to link standard entries. The related CREs will not get the standard entries aside. I see your point. I guess it can be an option that is off by default to include the related CREs column in the template. So yes: two formats. and indeed not for this PR.

application/utils/spreadsheet.py Outdated Show resolved Hide resolved
@northdpole northdpole force-pushed the feature-531-offseted-cre-csv branch from 9212b92 to a139636 Compare July 28, 2024 15:05
…in an instance in a visually pleasing format
@northdpole
Copy link
Collaborator Author

@northdpole northdpole force-pushed the feature-531-offseted-cre-csv branch from a139636 to 173e7d6 Compare July 28, 2024 18:13
@northdpole northdpole merged commit 096b48a into main Jul 28, 2024
5 of 7 checks passed
@northdpole northdpole deleted the feature-531-offseted-cre-csv branch July 28, 2024 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants